var selectedElmt, tmpColor, isDown = false, highLightColor='#728FB5';
document.onmouseover=function(e){
	if(e.button!=0){return;};
	selectedElmt=e.srcElement;
	tmpColor = selectedElmt.style.backgroundColor;
	selectedElmt.style.backgroundColor=highLightColor;
}

document.onmouseout=function(e){
	if(e.button!=0) return;
	if(selectedElmt){
		selectedElmt.style.backgroundColor=tmpColor;
	}
}

document.onmousedown=function(e){
	isDown=true;
}

document.onmouseup=function(e){
	isDown=false;
}

document.onkeydown=function(e){
	if(!isDown||!selectedElmt) return;
	isDown=false;
	if(e.keyCode==65){
		console.debug(selectedElmt);
		alert(selectedElmt.outerHTML);
	}
	if(e.keyCode==68){
		selectedElmt.parentNode.removeChild(selectedElmt);
		selectedElmt=null
	}
};